<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>第 27 题</title>
    <script type="text/javascript">
        /*
            27、列出1~10000的所有质数。
        */
        setTimeout(() => {
            // 循环
            for (var oNum = 1; oNum <= 10000; oNum++) {
                // 创建数组
                var aSet1 = [];

                // 循环
                for (var oNum1 = 1; oNum1 <= oNum; oNum1++) {
                    // 判断是否是约数
                    if (oNum % oNum1 == 0) {
                        // 推入数组
                        aSet1.push(oNum1);
                    }
                }

                // 判断是否是 1 和 它本身
                if (aSet1[0] == 1 && aSet1[1] == oNum) {
                    console.log(oNum + " 是质数");
                }
            }
        }, 0)
    </script>
</head>

<body>

</body>

</html>